#!/usr/bin/env python
# -*- coding:utf-8 -*-

import redis

# 默认 redis 是 0 - 15 个库
# 打开数据库服务

# 1.连接数据库
try:
	# client = redis.StrictRedis(host='127.0.0.1', port=6379)
	client = redis.StrictRedis()

	# 2. string hash list set zset

	# string
	result = client.set('key1', 'new')
	print(result)  # 成功返回True，失败返回False
	result = client.get('key1')
	print(result)  # 成功返回类型bytes，失败返回None
	result = client.delete('key1', 'zset1')
	print(result)  # 成功是1，没有是0
	result = client.keys()
	print(result)
except Exception as e:
	print(e)


